/**
 * 
 */
package mx.gob.inp.presupuesto.util;

import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

/**
 * @author 043h68
 * 
 */
public class HibernateUtil {

	private static final SessionFactory sessionFactory;

	static {
		
		try {
			
			sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();

		} catch (Throwable ex) {
			
			System.err.println("Fallo en la creacion de la SessionFactory."	+ ex);
			ex.printStackTrace();
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() throws HibernateException {
		
		return sessionFactory;
	}

}
